#coding=utf-8

import epics
import tornado
from controller.BaseHandler import BaseHandler
from controller import cagetDouble

class Handler(BaseHandler):

    @tornado.web.asynchronous
    @tornado.gen.coroutine
    def get(self):
        # 返回内容
        self.tplAssigns['doubleValues'] = []

        HWSPT01 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:HWS:HWSPT01:PRS:ai')
        self.tplAssigns['doubleValues'].append(['重水波动箱压力', HWSPT01, 'Mpa'])

        HWSPT03 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:HWS:HWSPT03:PRS:ai')
        self.tplAssigns['doubleValues'].append(['重水泵A出口压力', HWSPT03, 'Mpa'])

        HWSPT05 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:HWS:HWSPT05:PRS:ai')
        self.tplAssigns['doubleValues'].append(['重水泵B出口压力', HWSPT05, 'Mpa'])

        LCS1PT01 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:LCS1:LCS1PT01:PRS:ai')
        self.tplAssigns['doubleValues'].append(['轻水1波动箱压力', LCS1PT01, 'Mpa'])

        LCS1PT03 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:LCS1:LCS1PT03:PRS:ai')
        self.tplAssigns['doubleValues'].append(['轻水1泵出口压力', LCS1PT03, 'Mpa'])

        LCS2PT01 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:LCS2:LCS2PT01:PRS:ai')
        self.tplAssigns['doubleValues'].append(['轻水2波动箱压力', LCS2PT01, 'Mpa'])

        LCS2PT03 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:LCS2:LCS2PT03:PRS:ai')
        self.tplAssigns['doubleValues'].append(['轻水2泵出口压力', LCS2PT03, 'Mpa'])

        HPGPT01 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:HWS:HPGPT01:PRS:ai')
        self.tplAssigns['doubleValues'].append(['重水保护气缓冲罐压力', HPGPT01, 'Mpa'])

        LPGPT01 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:LCS1:LPGPT01:PRS:ai')
        self.tplAssigns['doubleValues'].append(['轻水保护气缓冲罐压力', LPGPT01, 'Mpa'])

        HPGPT09 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:HWS:HPGPT09:PRS:ai')
        self.tplAssigns['doubleValues'].append(['重水氮气瓶A压力', HPGPT09, 'Mpa'])

        HPGPT10 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:HWS:HPGPT10:PRS:ai')
        self.tplAssigns['doubleValues'].append(['重水氮气瓶B压力', HPGPT10, 'Mpa'])

        LPGPT06 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:LCS1:LPGPT06:PRS:ai')
        self.tplAssigns['doubleValues'].append(['轻水氮气瓶A压力', LPGPT06, 'Mpa'])

        LPGPT07 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:LCS1:LPGPT07:PRS:ai')
        self.tplAssigns['doubleValues'].append(['轻水氮气瓶B压力', LPGPT07, 'Mpa'])

        HPGCHT01 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:HWS:HPGCHT01:PER:ai')
        self.tplAssigns['doubleValues'].append(['重水氢含量', HPGCHT01, '%'])

        LPGCHT01 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:LCS1:LPGCHT01:PER:ai')
        self.tplAssigns['doubleValues'].append(['轻水1氢含量', LPGCHT01, '%'])

        LPGCHT03 = yield self.backend.submit(cagetDouble, 'EXP_TB_EU:LCS1:LPGCHT03:PER:ai')
        self.tplAssigns['doubleValues'].append(['轻水2氢含量', LPGCHT03, '%'])

        self.render("ezca/water.html", **self.tplAssigns)
